<?php
require_once ($_SERVER['DOCUMENT_ROOT']."/control/config.php");
require_once ($_SERVER['DOCUMENT_ROOT']."/MainProcessing.php");

//unset($_SESSION['matvv']);

?>

<SCRIPT language="JavaScript"><!--
	//FUNCTION TO CHANGE THE NUMBER OF DAYS IN THE DROPDOWN LIST	
	
	function submitform()
	{
		document.srch.view.value = 1;
		document.srch.submit();
	}
	
	--></SCRIPT>


<!-- Thinh -->

<style type="text/css">
h4.title {
	margin: 5px 20px;
	text-align: center;;
	font-size: 20px;
	color: rgb(240, 95, 14);
	font-family: Arial;
	float: left;
	cursor: pointer;
	display: block;
}

.div-content {
	margin: 20px auto;
	width: 600px;
	min-height: 200px;
	border: 1px solid #EEE;
	border-radius: 10px;
	background-color: #F8F8F8;
	display: none;
	clear: both;
	padding:5px;
}

.div-content>h3 {
	margin: 0;
	padding: 0;
	width: 100%;
	float: left;
	text-indent: 20px;
	font-size: 18px;
	height: 32px;
	line-height: 32px;
	text-shadow: 1px 0 0 #FFF;
	font-family: arial;
	font-size: 16px;
	color: rgb(17, 123, 238);
	background: #EEE;
	background-image: -moz-linear-gradient(top, white, #DDD);
	background-image: -ms-linear-gradient(top, white, #DDD);
	background-image: -o-linear-gradient(top, white, #DDD);
	background-image: -webkit-linear-gradient(top, white, #DDD);
	background-image: linear-gradient(top, white, #DDD);
	border-radius: 10px 10px 0 0;
}

h4.title:hover {
	text-decoration: underline;
}

table.tableDK {
	width: 100%;
	float: left;
}

table.tableDK tr td {
	border-right: 1px solid #DDD;
	border-bottom: 1px solid #EEE;
	background-color: white;
}

table.tableDK tr td input[type=text] {
	width: 90%;
	float: left;
	border-radius: 4px;
	height: 32px;
	margin: 1px 2px;
	border: 1px solid #DDD;
	font-size: 14px;
	text-indent: 5px;
}

table.tableDK tr td b {
	text-align: right;
	padding-right: 4px;
	display: block;
	font-size: 13px;
	font-family: arial;
}

table.tableDK tr td div.note {
	font-size: 13px;
	color: red;
}
</style>

<h4 class="title" onclick="ToggleForm('1')">Đăng Ký Đo TruAge</h4>
<h4 class="title" onclick="ToggleForm('2')">Hướng Dẫn Đăng Ký</h4>

<div id="formRegister" class="div-content">
<h3>Đăng Kí Đo TruAge</h3>
<form action=/MainProcessing.php method=post name=frm_registerTruage>
<table class="tableDK" border=0 cellpadding=2 cellspacing=0>
	<tr>
		<td width="14%" class=formfield bgcolor=#DBDBDB><b>Mã TVV</b></td>
		<td width="36%"><input type=text class=formfield name=matvv size=20
			maxlength=50 value="<?=$_SESSION['matvv'];?>" disabled />
			<input type=hidden name=registerTruage value=registerTruage /></td>
		<td width="14%" class=formfield bgcolor=#DBDBDB><b>Họ Tên</b></td>
		<td width="36%" class=formfield><input type=text class=formfield
			name=kh_hoten size=20 maxlength=50 /><font color=red>*</font></td>
	</tr>
	<tr>
		<td class=formfield bgcolor=#DBDBDB><b>Điện Thoại</b></td>
		<td class=formfield><input type=text class=formfield name=kh_dt
			size=18 maxlength=50 /><font color=red>*</font></td>
		<td class=formfield bgcolor=#DBDBDB><b>Ngày Đo</b></td>
		<td class=formfield><input type=text class=formfield name=ngaydo
			id="ngaydo" size=20 maxlength=50><font color=red>*</font></td>
	</tr>
	<tr>
		<td class=formfield bgcolor=#DBDBDB><b>Địa chỉ</b></td>
		<td class=formfield><input type=text class=formfield name=kh_diachi
			size=20 maxlength=50 /></td>
		<td class=formfield bgcolor=#DBDBDB><b>Năm Sinh</b></td>
		<td class=formfield><input type=text class=formfield name=kh_namsinh
			size=20 maxlength=50 /><font color=red>*</font></td>
	</tr>
	<tr>
		<td class=formfield bgcolor=#DBDBDB><b>Email</b></td>
		<td><input type=text class=formfield name=kh_email size=20
			maxlength=50 /></td>
		<td class=formfield bgcolor=#DBDBDB><b>CMND</b></td>
		<td><input type=text class=formfield name=kh_cmnd size=20 maxlength=50 /></td>
	</tr>
	<tr>
		<td class=formfield bgcolor=#DBDBDB colspan=4>
		<div class="note">(*): Điều kiện bắt buộc</div>
		</td>
	</tr>
</table>
<br>
<center><input type=submit value="Đăng Kí"
	onclick="javascript: return checkNum()" class=button>&nbsp;&nbsp; <input
	type=button value="Hủy" onclick="HideDialog('1')" class=button></center>
</form>

<script type="text/javascript">	   	
	   		$("#ngaydo").datepicker();
	   		$("#ngaydo").datepicker( 'option', 'dateFormat', 'yy-mm-dd' );
	   </script></div>

<div id="huong-dan" class="div-content">
<h3>Hướng Dẫn Đăng Ký</h3>
<b><u>Bước 1</u></b>
Xem số lượng đăng ký phía trên để biết số lượng đăng ký trong các ngày.
<img src="/images/buoc1.png" /><br />
<b><u>Bước 2</u></b>
Click vào chữ: Đăng Ký Đo TruAge
<img src="/images/buoc2.png" /><br/>
<b><u>Bước 3</u></b>
Nhập đầy đủ thông tin khách hàng vào ô đăng ký. Sau đó nhấn nút: Đăng Ký
<img src="/images/buoc3.png" /><br />
<b><u>Bước 4</u></b><br>
Đăng kí thành công, kiểm tra lại thông tin khách hàng dựa trên danh sách được xuất ra trong ngày
<img src="/images/buoc4.png" /></div>
<div style="width: 100%; display: block; clear: both;"></div>

<script type="text/javascript">
	function ToggleForm(id){
		if(id == 1)
		{
			//$("#formRegister").show("slow");
			$("#huong-dan").hide("slow");
			$("#formRegister").toggle("300");
		}
		else if(id == 2)
		{
			//$("#formRegister").hide("slow");
			$("#formRegister").hide("slow");
			$("#huong-dan").toggle("300");
		}
		
		//alert("123");
		//$("#div2").toggle();
	}

	function HideDialog(id){
		if(id==1)
			$("#formRegister").hide("slow");
	}
</script>

<?php

/////////////Heading Text/////////////////
print("<form name='srch' method='post' action='Main.php' onSubmit='javascript: submitform();'>\n");

Create_Table();
Create_Table_Heading_Row_Options("bgcolor='#555566' class='normal'");
Table_Cell_Col_Span( "<font color='#FFFFFF'> <b>DANH SÁCH KHÁCH HÀNG ĐO TRUAGE</b></font>\n","3");
print("<td class='normal' colspan='2'><div align='right'>");
print("<input class='button' type='submit' name='submit' value='Xem'></td>");
Close_Table_Row();
Create_Table_Heading_Row();
Table_Heading_Cell("<strong>Ngày Đo (YYYYMMDD)</font></strong></div>");
print("<td bgcolor='#FFFFFF' rowspan='2'><div align='center'><strong>- HOẶC -</strong></div></td>");
Table_Heading_Cell("<strong> Từ Ngày (YYYYMMDD)</font></strong></div>");
Table_Heading_Cell("<strong> Đến Ngày (YYYYMMDD)</font></strong></div>");
Close_Table_Row();
print "<input type='hidden' name='view' value='0' />";
Create_Table_Row();		// FOR THE FIRST TIME THE PAGE IS CALLED - SET TO CURRENT DATE
?>
<td><input type="text" name='date' id="date" value='' class='formfield' />&nbsp;
<input type='image' src='images/calendar.png' id="calendar1"
	class='formfield' /> <script type="text/javascript">//<![CDATA[
		  Zapatec.Calendar.setup({
			firstDay          : 1,
			electric          : false,
			inputField        : "date",
			button            : "calendar1",
			ifFormat          : "%Y%m%d",
			daFormat          : "%Y%m%d"
		  });
		//]]></script></td>

<td><input type="text" name='fromdate' id="fromdate" value=''
	class='formfield' />&nbsp; <input type='image'
	src='images/calendar.png' id="calendar2" class='formfield' /> <script
	type="text/javascript">//<![CDATA[
		  Zapatec.Calendar.setup({
			firstDay          : 1,
			electric          : false,
			inputField        : "fromdate",
			button            : "calendar2",
			ifFormat          : "%Y%m%d",
			daFormat          : "%Y%m%d"
		  });
		//]]></script></td>

<td><input type="text" name='todate' id="todate" value=''
	class='formfield' />&nbsp; <input type='image'
	src='images/calendar.png' id="calendar3" class='formfield' /> <script
	type="text/javascript">//<![CDATA[
		  Zapatec.Calendar.setup({
			firstDay          : 1,
			electric          : false,
			inputField        : "todate",
			button            : "calendar3",
			ifFormat          : "%Y%m%d",
			daFormat          : "%Y%m%d"
		  });
		//]]></script></td>
<?

Close_Table_Row();

print("</form>");

Close_Table();

//Xu li javascript gan View = 1 khi submit
if (isset($_REQUEST['view']) && $_REQUEST['view'] == 1){
	require_once 'MainView.php';
}

?>